package com.example.demo.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000118634976";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDwLKdX/44akwSW06kfRGmCPh2YqiX0Fb3R5+N/zECus2iXMKh7hPjRuogRLH7muBT5G0qiUl+pkQ1xha88pGQ3ROEXsmjbHaKiLmk5UwezQkDSB0cc4sUYRjgeZYBHipVnecrYYEGXUII/zK6tAAcE3PXmqKqN0umWvGkkpZIdYH57A2POilTJBh09M6OBWd2D02jFeXiYNBj1dJb+w+ITqpjXYV5ikGqd1Q0TZUqFGNEOZBroOnLH31dijajYm0uqhkChP95i/JESvTkOtL9pLbTJ9FlgTyIf1tOq4Avi//RgQj1Ee/WK7iuH5Ll98bGbk7uYL84GPacneQ1tPHPAgMBAAECggEBAInVa29IojaTElFynWNQ9VZVxq2FNnT/K90eP4i6gYYMhrKmYh2nB7XmvwBNno0tNnubwgpLdMaKyEic3HHa0wiPwihYnd5Ghwlw0Fb9ZaXidVAsPONFsE5/OAcHVcoftWtnrdhr5W/XxqGTH+M6z0D1qYHMznDQUqImMzPQS6Vka/2Ud5HwHSY7btOcfL2olzleO6I7+DftdzCq3jq6rGIjrt8g63xbeq8cuasYcyLaqEMf3BhJWFw1/Kh03uX5qb8OviLujxAsTLvQOL9AbXNoipUPkSM/jt/ryTzdhcNqRekQyuRYR7EjqHQmwkQ6osq8p0YtFPEDaUz7q9GH6zECgYEA8uLYpfThnl/Y1VJ7RsZLXkMUi9k0GARuQI7+3yLBFwzZRHX3leTWPGDAT5FNwgAo6R6+GY7f0gxz/Cc/nVm2adBkTRnEoKVv5yl9cZBSvnTna5/ZdXqr0tpVtTCwpvh8gz9kCu3TvKG7kMP7djjNoSpnnwZNXNIc/j7Qlh/0CD0CgYEAzlJgkMk/Qwd764VhnkT2T7Wg9TOFltuCILZIeK3X4foFeZ3pxuYR+B1ZMU6bwXtZSprHv46xAEfnn/oGWDWqBH73sM4srpaI3DoNfvs6IB5TQb0HvKQTWHxRvZdKcS5clHZh5NMiIQA0loNIGkNmZj4bsLkV4rx7Cr++xA3ENvsCgYAE1xRuKjUczNgrWBtwy57Q4BFWwBtTpzLzQmY92Bl09iKWRKuMZyUFyv/KFiEwjoRCMQSkyb4YF3twOPABmLoT3b1B9BOBCAr01lTToIalmPrLoEHbH3ixGPzAQZojmawRiX/a3+ZqSebM+brXHkaqwYeTGbMM+Hrvbh0GANkCGQKBgF/wyHyrSGKX+VTUykb5lHwOXpGG6sjyu/kQKnULicbIJ4GdH9dgptx0cURPZHg9LpFVlisKZF5YEWo/rnGYSr4aeH1b8kUhNPULfbkdg7LpxxdbmlxrA5/y92OtFW25/E0BG5Z3Y3hrCwkudPnZe6Vxnhi4iGfN831VGpU6PZK/AoGBAIA7t9fg/GeB1ibkkRG4RTSfGg/RaYq6+P4ZjnHbtrNZINFV4Pl9jGTGFdIZMVBVc6jBNrpHYzoQ6JA12W+uG3uBXFCsEPvEWibSa6nVNqghRrRnNR3Ohiii3g1CyokirO2QIlpnpUY8e6VP0vBr2gXUxMcv2xlqmrK1gXyVkHMx";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoGZ+fGpdu/NUDor8/ZoSX6d8kfMyC2MA/hjcWfDM6/MJdnbO1EQLl9Z4U7/mV1bdapNr15Oz6+S/Z/EmxZmZb0wKDpxDMl2EEg2uW1FpHJHnAqmdPpyh2iaOKjoeQ4Z6+YDz2G7uQiR36lj/LrbPKXAQKbDuLDf5bjtUdVJregpjnvvv0fLzJgToIDmUBwpC9NgbabbbC4dXhmZER8cQFm/l8jC1a71d1yfm4PPdcXMB7d2jNBfy8/ISEBKg+b1R4A2DNRP2tkbD8ahw0ibzgnZ64bbfpmyLncVxsvs82/eHWj/AdOusQASnO1TOFOMzC7nQDH+X/ryyKHf3yFBhQwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://eshop.free.svipss.top/order/update";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://eshop.free.svipss.top/"; //localhost:8080

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
